home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 422_04 / mbasic.doc < prev    next >
Text File  |  1994-02-14  |  46KB  |  995 lines

  1.    
  2.    
  3.    
  4.    
  5.    
  6.    
  7.    
  8.    
  9.    
  10.    
  11.    
  12.    
  13.    
  14.    
  15.    
  16.    
  17.    
  18.    
  19.    
  20.    
  21.                            Micro Basic Users Guide
  22.    
  23.       I originally wrote Micro Basic in  1980  for  a  University  Computer
  24.    Club, in which the members were building their own 8085 based systems.
  25.    
  26.                                 Dave Dunfield
  27.    MICRO BASIC USERS GUIDE                                          Page: 1
  28.  
  29.  
  30.    1. INTRODUCTION
  31.    
  32.          Micro Basic was implemented with the intention  of  providing  the
  33.       maximum amount of features and flexibility, in the minimum amount  of
  34.       memory space. It is intended for use on 8080/8085/Z80 based computers
  35.       which are too small to afford the use of larger programming  systems.
  36.       Currently, the Micro Basic  interpreter,  is  3K  bytes  in  size.  A
  37.       machine-language MONITOR and all hardware dependant I/O routines  are
  38.       also included, bringing the total rom size to 4K. A minimum of 3K  of
  39.       ram is required if any useful programs  are to  be  implemented.  The
  40.       interpreter only makes use of memory as it needs it, and  memory  can
  41.       be expanded at any time, to allow for larger programs or  more  array
  42.       space.  Micro  Basic  is  quite  different  from  most  other   BASIC
  43.       interpreters,  in  particular  the  right  to   left   execution   of
  44.       expressions, with no operator precedence, and  the  use  of  separate
  45.       operators for EQUALS and ASSIGNMENT. These implementation  decisions,
  46.       were in part, based on the language APL, which is a favorite language
  47.       of the author.
  48.    
  49.          The Micro Basic rom, is assembled to  go  at  location  zero,  and
  50.       occupies the range of addresses from 0000-0FFF. The software supports
  51.       a 16 line by 64 character 1K  memory  mapped  video  display,  to  be
  52.       located in the address range from 1000-13FF. The  system  RAM  should
  53.       start at 1400 and may continue on up to FFFF. The keyboard should  be
  54.       on a parallel input port,  located  as  port#0,  with  the  keystrobe
  55.       (active high) on bit#7, and ASCII data is expected on bits  0-6.  The
  56.       keystrobe should remain high for as long as the key  is  pressed. The
  57.       serial I/O for the tape is expected to be an INTEL 8251 with the data
  58.       port mapped as port#1, and the control port as  port#2.  The  receive
  59.       and transmit clocks should be 16x the desired speed.
  60.    
  61.          On the following pages, is a brief description  of  Micro  Basic's
  62.       commands and features.
  63.    MICRO BASIC USERS GUIDE                                          Page: 2
  64.  
  65.  
  66.    2. COMMANDS
  67.    
  68.          Operands to commands are as followes:
  69.    
  70.          <e> - Any expression.
  71.          <v> - Any variable.
  72.          <a> - Any array variable.
  73.          <n> - Any numeric expression.
  74.          <l> - A line number.
  75.          [ ] - Optional operands.
  76.          ... - Multiple extra operands allowed.
  77.    
  78.       2.1 General commands
  79.    
  80.             The following  commands,  may  be  entered  directly  from  the
  81.          keyboard, or executed with a BASIC program.
  82.    
  83.          CLEAR
  84.    
  85.             Clears  all  numeric  and  character  variables,  Delete's  all
  86.          arrays, and resets the control stack and data pointer.
  87.    
  88.          DIM a1(<n1>)[,a2(n2)]...
  89.    
  90.             Dimensions integer arrays a1, a2,... makeing  them  n1,  n2,...
  91.          elements each. Arrays may be REDIMENSIONED with the DIM statement,
  92.          however this allocates new memory for the array, causing  the  old
  93.          memory used by the old array to be  made  unusable  (until  'NEW',
  94.          'CLEAR' or a 'RUN'  command  is  issued).  Whenever  an  array  is
  95.          dimensioned or redimensioned via DIM, it is cleared to zeros.
  96.    
  97.          NOTE: Array space is allocated in memory, starting at the  end  of
  98.                the program source. As a result, if a line is inserted  into
  99.                the program, or any line is replaced  in  the  program,  any
  100.                existing arrays will be deleted.
  101.    
  102.          END
  103.    
  104.             Stops the program. no messages are issued.
  105.    
  106.          EXIT
  107.    
  108.             Exits to the system monitor.
  109.    
  110.          GOTO <line#>
  111.    
  112.             Transfers program execution to the statement at  the  beginning
  113.          of line <line#>.
  114.    
  115.          GOTO(<n>),<l1>[,<l2>]...
  116.    
  117.             Transfers program execution to the statement at  the  beginning
  118.          of line <l1> if <n>=0, to the beginning of  line  <l2>  if  <n>=1,
  119.          etc. results in SYNTAX ERROR if <n> is greater than number of line
  120.          numbers given.
  121.    MICRO BASIC USERS GUIDE                                          Page: 3
  122.  
  123.  
  124.          INPUT <v>
  125.    
  126.             Requests a value for <v> from  the  terminal.  Prompts  with  a
  127.          question mark "?". If <v> is a character variable, then  any  text
  128.          can be input. If <v> is numeric, then value  supplied  must  be  a
  129.          number or expression.
  130.    
  131.          INPUT "<text>",<v>
  132.    
  133.             Same as above, but prompts with <text> instead of  "?".  <text>
  134.          can be a null string ( INPUT "",<v> would give no prompt ).
  135.    
  136.          NOTE: The value of a character variable can be used in the prompt,
  137.                but must be concatinated with <text>. EG: ' INPUT ""+A$,V '.
  138.    
  139.          LET <v>=<e> (default)
  140.    
  141.             Assigns the value of <e> to the variable <v>. If any lines  are
  142.          found by the interpreter which do not contain a command, then they
  143.          are assumed to be LET.
  144.    
  145.          LIST [<l1>][,<l2>]
  146.    
  147.             Lists the program,if no operands  are  given,  then  lists  the
  148.          entire program. If <l1> is given then only that line is listed. If
  149.          <l2> is also given, then lists from <l1> to <l2> inclusive.
  150.    
  151.          LOAD
  152.    
  153.             Loads  a  program  from  tape.  Flashes  a  '*'  in  the  upper
  154.          right-hand corner of the screen for every record (255 Bytes)  that
  155.          is loaded.
  156.    
  157.          NEW
  158.    
  159.             Clears the program, variables, and arrays.
  160.    
  161.          ORDER <line#>
  162.    
  163.             Positions the read pointer to the start of  the  line  <line#>.
  164.          This line must begin with a DATA statement, or a  DATA ERROR  will
  165.          occur.
  166.    
  167.          PRINT <e>[,<e>][,<e>]...[,]
  168.    
  169.             Prints the expressions on the terminal. Numeric values will  be
  170.          printed with  a  preceding  space.  If  a  numeric  expression  is
  171.          preceded by a single '(', then the preceding space is not printed.
  172.          ( EG: PRINT 12,(12 would  display  '  1212'  ).  If  the  list  of
  173.          expressions ends with a trailing comma, then no line-feed carriage
  174.          return will be  printed,  causing  the  next  PRINT  statement  to
  175.          continue at the end of the same line.
  176.    MICRO BASIC USERS GUIDE                                          Page: 4
  177.  
  178.  
  179.          PLOT <x>,<y>[,<e>][,<e>]...[,]
  180.    
  181.             Same as PRINT, except cursor is positioned at column <x>,  line
  182.          <y> (from the top lefthand corner of the screen), before the  rest
  183.          of  the  operands  are  printed.  'PLOT  <x>,<y>'  with  no  other
  184.          operands, will position the cursor with no output.
  185.    
  186.          READ <v>[,<v>]...
  187.    
  188.             Reads the values for variables from data statements.  An  ORDER
  189.          statement must be done before the first read  in  a  program,  and
  190.          anytime that you have read all the data in a data  block.  A  data
  191.          block, is a  collection  of  data  statements  which  are  located
  192.          separately, with no other  statements  between  them.  If  a  read
  193.          statement does not read all of the data in a given data statement,
  194.          then the next read will pick up where the last one left off. If  a
  195.          read statement reads beyond the end of a data  statement,  the  it
  196.          will advance to the next statement and attempt to read from there.
  197.    
  198.          REM <text>
  199.    
  200.             Comment, the rest of the statement is